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