UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pPISL0yEwvngVLLJTdblMYjXqCJqqH8BaEBRwFR97dI=' 
WHERE 
  key_id = '98394ad738d5dcf5107c1c0e0f3c46a59d9ece157170082333a2632880c2d19a' 
  AND (
    token = 'pPISL0yEwvngVLLJTdblMYjXqCJqqH8BaEBRwFR97dI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042