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