UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+9JOUrI8UVd/GI5aWWJCxLecTwudWWLEyNY2qIG7C38=' 
WHERE 
  key_id = '2fe7a9cadd2ce4e9049ccc4bc1671706fbc89ba3793a1ece6d82534600d7a951' 
  AND (
    token = '+9JOUrI8UVd/GI5aWWJCxLecTwudWWLEyNY2qIG7C38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023