UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PVSNE4WWSWRq4xv55MpkpaoiYwJs1aB07wPYZt+p48A='
WHERE
key_id = 'be4e0c57daa5c4da4025aff3a32b446185b11357e37c4d708d1f53c63afa8c35'
AND (
token = 'PVSNE4WWSWRq4xv55MpkpaoiYwJs1aB07wPYZt+p48A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)