UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BYiD9SfggoP/1iCmuXgDchZt4iFP26Y8Ng56BP56B6M=' 
WHERE 
  key_id = '807b4e6f06cfa25005ac99bfff186ee371169dc414fdde40a0ad1fd3614ea404' 
  AND (
    token = 'BYiD9SfggoP/1iCmuXgDchZt4iFP26Y8Ng56BP56B6M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044