UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7FlbyYYem5dF+3xSeYc7CiaFoENiwZFlB4wiMMAyoiM='
WHERE
key_id = 'b8b71e31bb0dacbe15df879e48b3c01f397fdf58f8175a483e319a86e35a233b'
AND (
token = '7FlbyYYem5dF+3xSeYc7CiaFoENiwZFlB4wiMMAyoiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)