UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8xVHeazuMXskf6ipopiMSNhZ9j0aLCq0szNMj6Q1RRE='
WHERE
key_id = 'db8f13589d5b44598663e5dc22cdf3a6c3e8889cfed681670ceee4975c281583'
AND (
token = '8xVHeazuMXskf6ipopiMSNhZ9j0aLCq0szNMj6Q1RRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)