UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nkPM+pEyOpZKbrSKeBA9HNZXc7ZnGP9ByfSxFymBLgI=' 
WHERE 
  key_id = '4786ead24231ed091f1cfa5864df10de3a2c071c27779ba6b20d11cc0e6c8223' 
  AND (
    token = 'nkPM+pEyOpZKbrSKeBA9HNZXc7ZnGP9ByfSxFymBLgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042