UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o1wN7j22B0eqdaMLgCbiMbi3Jv80wYFAEP/E1PUedIE=' 
WHERE 
  key_id = '4610c8d2215966d9457cf8a3a443c08a11287e76d9e99ae8830d6ee32094213a' 
  AND (
    token = 'o1wN7j22B0eqdaMLgCbiMbi3Jv80wYFAEP/E1PUedIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036