UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EDoJcYoiz2of5KkgbOITqrFUzk3KzSqB4+f2yNh/FL8='
WHERE
key_id = 'fc81ce9ce3bf0383785c61cd60876accd29c195e027ec804bca7c0af545ce884'
AND (
token = 'EDoJcYoiz2of5KkgbOITqrFUzk3KzSqB4+f2yNh/FL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)