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