UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rthJSUrVVNvxndKX/13RVPGoG2WrGrA1joUtNAwAa7Y=' 
WHERE 
  key_id = '9c8b6687272fe7312955de3aaa2fbefbede25db53679b40cdd2b4d7d5df99ae1' 
  AND (
    token = 'rthJSUrVVNvxndKX/13RVPGoG2WrGrA1joUtNAwAa7Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046