UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NoNvuFnCKi6KzahcNrqpRPYiC8LgWt+6SpsNZiup9Q8='
WHERE
key_id = '5377063bc49ff670c2fcc243d128bf26f0310e1f058d441440a84e79b741cbdc'
AND (
token = 'NoNvuFnCKi6KzahcNrqpRPYiC8LgWt+6SpsNZiup9Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)