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