UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wgR9Zln4fOvxYEE4JvI33c7AeboSmpoBbWVul5vXpw4='
WHERE
key_id = 'e4cde31a6ae2b5a045eaed3725632810ee89cfb0c483dccbbb146bf758022638'
AND (
token = 'wgR9Zln4fOvxYEE4JvI33c7AeboSmpoBbWVul5vXpw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)