UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJ7VH8KPh4ZMWpYjhV0o2R5zXqh7IJVRgPwOMTSPVcI=' 
WHERE 
  key_id = '399191729068d970d8e691aa15e5f0dd10a1e12d71ce32f9b691930588698b4e' 
  AND (
    token = 'AJ7VH8KPh4ZMWpYjhV0o2R5zXqh7IJVRgPwOMTSPVcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026