UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gGyptnZZ6cTAmzk68H2ik1xESq9D5XizfiyoHnIHpzo='
WHERE
key_id = '798cf831ece141f1f164944d8b30522c646ac7c4c4f6903fcc18c04dad23d531'
AND (
token = 'gGyptnZZ6cTAmzk68H2ik1xESq9D5XizfiyoHnIHpzo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)