UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6UOa3EAPfgatJcz9wJqHg6knjisrrMgvfdsHUHPVwY4='
WHERE
key_id = 'b996f6f6da4c56ae6d787ec31956b49590515fc916bbf56e5313771a46ffce9b'
AND (
token = '6UOa3EAPfgatJcz9wJqHg6knjisrrMgvfdsHUHPVwY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)