UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OFKo17yOYHmluKTT6Ordl6iPZV+XwLoSnG+rMGr4idI=' 
WHERE 
  key_id = '31494fff60bcd38358162e09af9f885f9ed57d989c476e9d341973a26727f968' 
  AND (
    token = 'OFKo17yOYHmluKTT6Ordl6iPZV+XwLoSnG+rMGr4idI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025