UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QO4wHzbd8vWhq+bso+ACnTWi8kuVBNfUKAhL00IPlkg='
WHERE
key_id = '65d1fe0a2da0539853b177e4741ed3218cb32355c9ca13cdf2ec2ba850838b3a'
AND (
token = 'QO4wHzbd8vWhq+bso+ACnTWi8kuVBNfUKAhL00IPlkg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)