UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OPORcNyw14y4qaCDtDIBR8cVQxX7nU4b+HdURnguddY=' 
WHERE 
  key_id = '37169e546342ccbdac97aeb164c1b8b8d5dfa0ceaf2f3d3e6b2a2bf550e17f69' 
  AND (
    token = 'OPORcNyw14y4qaCDtDIBR8cVQxX7nU4b+HdURnguddY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067