UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wZ9WcA+xLfiMCZHhdKyeNF5uQ+LjFgzgAHN6S8wkofw=' 
WHERE 
  key_id = '758452584c2195466b6f1b9c286ad22515bd277f4b5b8001e22ddc53cad35e90' 
  AND (
    token = 'wZ9WcA+xLfiMCZHhdKyeNF5uQ+LjFgzgAHN6S8wkofw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052