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