UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XwFVdUfme7sEuN9w9IZPrdGiLQtgaxgNdEP1dpsQL/8='
WHERE
key_id = '321a348565f1f5005ce0835714c86f709d2b9c4199bbea3d10ec2d51d2da7f06'
AND (
token = 'XwFVdUfme7sEuN9w9IZPrdGiLQtgaxgNdEP1dpsQL/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)