UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TB4uxxptfAJqkzvoSaAxFyFOEMmjEiOAn9zuIDqIJWQ='
WHERE
key_id = '304fd686f9e0d98a1f96096f8b420de00d1cd6495306772659b613efbe62ba3e'
AND (
token = 'TB4uxxptfAJqkzvoSaAxFyFOEMmjEiOAn9zuIDqIJWQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)