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