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