UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sQdhOYp0UxOSpgqBVJGtRiKEqMqGlTLMKartjg9lWeo='
WHERE
key_id = 'debe9bf0c172ae287a7c93b1a44aeae60e5cd68f93233057059f126c98591780'
AND (
token = 'sQdhOYp0UxOSpgqBVJGtRiKEqMqGlTLMKartjg9lWeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)