UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1TfxIgDozh1gAr35WW9HcKxCZIzT48rGCf8zqwhiv6s='
WHERE
key_id = 'd1422f66393b24e528fb53754079d5eb3f6b9ed67347c85c9f4693619b20d7c1'
AND (
token = '1TfxIgDozh1gAr35WW9HcKxCZIzT48rGCf8zqwhiv6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)