UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '37Zj+W5YUZus2Zj5bJRWwbHeBh8JD6ZgkJbAXIzPX5Y=' 
WHERE 
  key_id = '0175f7310d7d4ad8dec028bd2aad6eddb927f7e7e89a0c65d507dfbf7c3c763c' 
  AND (
    token = '37Zj+W5YUZus2Zj5bJRWwbHeBh8JD6ZgkJbAXIzPX5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026