UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3YZ9X7ArzHEduQz3cAvouhiQjURCNlZnYn22D7P+utU='
WHERE
key_id = 'e73e481f1d87d2f5266005a9509116de6afb2360f014cc3fe43d699914858ec1'
AND (
token = '3YZ9X7ArzHEduQz3cAvouhiQjURCNlZnYn22D7P+utU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)