UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TeHOyMNJCCBD+VWPJ9eZr/J4KcKVEz2yUV+zsJokLTA='
WHERE
key_id = 'bdf930d5f4b5fc61e8fefcc830926f1b6831045c64469f67c851deaeb59a1e3b'
AND (
token = 'TeHOyMNJCCBD+VWPJ9eZr/J4KcKVEz2yUV+zsJokLTA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)