UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NCSFmPsoSgrD3UXG9mwwzXrpeio/Ij9b19izOqBeOdI='
WHERE
key_id = 'd4eec8866052baf52f8ce17d5de0e6043262b2ba168e4b8d5d01a8e88a4ef440'
AND (
token = 'NCSFmPsoSgrD3UXG9mwwzXrpeio/Ij9b19izOqBeOdI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)