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