UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'duHnusc2dD/V7/xlKNU7iRRClc6FYrL659zYb64sJDw='
WHERE
key_id = 'd4881193923002cffa5599e5d91157f59915a34ec80e285fd8b5379ff2bd732d'
AND (
token = 'duHnusc2dD/V7/xlKNU7iRRClc6FYrL659zYb64sJDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)