UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v8x+iA1EXntSsS9T9iaIgCyATEhC4ONHIQ3JfhYhBFM=' 
WHERE 
  key_id = '02a50f9a9177b0d7e3f58580d36c5a957f6dab0e15bf98bb2a218a2128a3498d' 
  AND (
    token = 'v8x+iA1EXntSsS9T9iaIgCyATEhC4ONHIQ3JfhYhBFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025