UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BygcF2lyMy8TjHoZ1wZCa4LMrex17ZxD1I+dMMbdpjs=' 
WHERE 
  key_id = '27655d6f86cecec7b8ceba05e280d381348aa85398c1216d0a715fc009c95187' 
  AND (
    token = 'BygcF2lyMy8TjHoZ1wZCa4LMrex17ZxD1I+dMMbdpjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029