UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '35aX0sOya0a0+ErrJF93FXqXAc336+/IhcqBKWOIAkM='
WHERE
key_id = 'b779d5508a337eb63c2e50ddba78d4a92b1fde72576bfd4365bdd1c354475d4f'
AND (
token = '35aX0sOya0a0+ErrJF93FXqXAc336+/IhcqBKWOIAkM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)