UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WnR3VZo6phvp6WA5t0h7xykDrYeX/aI0HqMladEhkeo=' 
WHERE 
  key_id = '47720f984aa8f43393a08aa11dfdc00cdd70034af78ea3a9e18db6d4df554175' 
  AND (
    token = 'WnR3VZo6phvp6WA5t0h7xykDrYeX/aI0HqMladEhkeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033