UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UaxlHe/Ny6vb/GGBSsu89UC/OQ1QPmReC9kAfOJ8QMw=' 
WHERE 
  key_id = '31b399954cbbe9f9a64457c77f3cf5fd10603cb73e18e5459cf0934c2ce32e97' 
  AND (
    token = 'UaxlHe/Ny6vb/GGBSsu89UC/OQ1QPmReC9kAfOJ8QMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030