UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UUpel0bfyMYC5nl9zAh7Zt/wa4g5g04/+2w+JXvtHJY='
WHERE
key_id = 'b6b7641d2983b2a7a535a656cf363a16bdddc86faa86d950ade9eaa1fd877be6'
AND (
token = 'UUpel0bfyMYC5nl9zAh7Zt/wa4g5g04/+2w+JXvtHJY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)