UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nX2pKqqdUkb+DI1ewWQOzdn4O0bLlgEGTTl9+RuimLk='
WHERE
key_id = 'f1217554ac386aff1cf1763959dfa77704858f604a44b6edc938ce8ab855a21c'
AND (
token = 'nX2pKqqdUkb+DI1ewWQOzdn4O0bLlgEGTTl9+RuimLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)