UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KeJRPhlfdvCmzD3Y7c3fnq65v6ccZAELvwk5ZDTjjhE='
WHERE
key_id = '2433c5fa7fa52d409f556088f5a973479f7e6b88c802b639ab2f2e05aee6a1c1'
AND (
token = 'KeJRPhlfdvCmzD3Y7c3fnq65v6ccZAELvwk5ZDTjjhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)