UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aPLE3NyUy0vab1m2pjb4LMnNx0MLGqF/ZMQxHljjfnk='
WHERE
key_id = '4e56a33344bbf6d18a62a91dbcaea52306509c7e412e3a1465fce03028bdf8d8'
AND (
token = 'aPLE3NyUy0vab1m2pjb4LMnNx0MLGqF/ZMQxHljjfnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)