UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CZZGatQhnAhtkfZEJNVNilAcffhOtMjtxKtMFVf/SdQ=' 
WHERE 
  key_id = '216a2fb717d486777f45a58bd9e4a852fc602ae1aec04ec2d0ea04d1ae535107' 
  AND (
    token = 'CZZGatQhnAhtkfZEJNVNilAcffhOtMjtxKtMFVf/SdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042